package com.qf.controller;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.qf.feign.SearchFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 千锋健哥
 */
@RestController
@RequestMapping("/test")
//动态刷新从配置中心拉取的内容
@RefreshScope
public class TestController {

    @Autowired
    private SearchFeign searchFeign;

    //从配置中心当中获取配合内容的值
    @Value("${version}")
    private String version;

    //从配置中心当中获取配合内容的值
    @Value("${username}")
    private String username;

    @GetMapping("/t1")
    public String t1() {
        String str = searchFeign.test();
        return str + "username=="  + username + "===version====" + version;
    }
}
